﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ChoDiaOc_HK_WPF.Controls;
using ChoDiaOc_HK_WPF.Models;

namespace ChoDiaOc_HK_WPF.Views.LapBaoBieu {
    /// <summary>
    /// Interaction logic for ThongKeDiaOc.xaml
    /// </summary>
    
    public partial class ThongKeDiaOc : UserControl {
        private DBEntities entities;
        private List<TKDiaOc> ListDiaOc;
        List<DIAOC> query;
        public ThongKeDiaOc() {
            InitializeComponent();
            entities = new DBEntities();
            List<string> Thang = new List<string>();
            Thang.Add("1");
            Thang.Add("2");
            Thang.Add("3");
            Thang.Add("4");
            Thang.Add("5");
            Thang.Add("6");
            Thang.Add("7");
            Thang.Add("8");
            Thang.Add("9");
            Thang.Add("10");
            Thang.Add("11");
            Thang.Add("12");
            cbxThang.ItemsSource = Thang;
        }
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            
            
        }

        private void cbxThang_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            query = DatabaseWrapper.GetInstance().GetAllDIAOC();
            int nam;
            if(int.TryParse(tbxNam.Text, out nam))
                ListDiaOc = TKDiaOc.getListDiaOc(query, int.Parse(cbxThang.SelectedItem.ToString()), nam);

            TKDOdataGrid.ItemsSource = ListDiaOc;
        }

        private void btnInBaoCao_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}
